package org.taobao.ibatiside.ui.binding;

import org.eclipse.core.databinding.conversion.IConverter;
import org.eclipse.core.resources.IResource;

public final class ResourceAsStringConverter implements IConverter {

	@Override
	public Object getFromType() {
		return IResource.class;
	}

	@Override
	public Object getToType() {
		return String.class;
	}

	@Override
	public Object convert(Object fromObject) {
		if (fromObject == null){
			return "";
		}else{
			return ((IResource)fromObject).getFullPath().toString();
		}
	}

}
